package com.example.homeworkrabbitmq.service.impl;

import com.example.homeworkrabbitmq.entity.User;
import com.example.homeworkrabbitmq.repository.UserRepository;
import com.example.homeworkrabbitmq.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserRepository userRepository;

    @Override
    @Transactional
    public void saveUser(User user){
        userRepository.save(user);
    }

    @Override
    public User findUserByUserName(String userName){
        return userRepository.findUserByUsername(userName);
    }

}
